import { FetchMeetingSpaceInfo, IMeetingInfo } from './interface'
import dayjs from '@/plugins/dayjs'
import { getMeetingTime } from '@/utils'

export function transMeetingInfo(meetingInfo: FetchMeetingSpaceInfo): IMeetingInfo {
	const _startTime = dayjs(meetingInfo.start_time).format('YYYY-MM-DDTHH:mm:ss')
	return {
		meetingMoid: meetingInfo.meeting_moid ?? '',
		name: meetingInfo.subject ?? '',
		e164: meetingInfo.e164 ?? '',
		dateTime: getMeetingTime(meetingInfo.start_time, meetingInfo.duration, meetingInfo.permanent_meeting === 1),
		startTime: _startTime,
		status: meetingInfo.state,
		isSigned: meetingInfo.is_signed === 1,
		isRecorded: meetingInfo.is_recorded === 1,
		createBy: meetingInfo.create_by || '',
	}
}
